<template>
  <el-dialog
    :visible.sync="visible"
    :show="visual"
    title="提示"
    width="30%"
    center
    @close="OnClose()">
    <span>需要注意的是内容是默认不居中的</span>
    <span slot="footer" class="dialog-footer">
      <el-button @click="OnClose">取 消</el-button>
      <el-button type="primary" @click="OnClose">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  props: {
    visual: { type: Boolean, default: false }
  },
  data() {
    return {
      visible: this.visual
    }
  },
  watch: {
    visual: {
      immediate: true,
      handler () {
        this.visible = this.visual
      }
    }
  },
  methods: {
    OnClose() {
      this.$emit('update:visual', false)
    }
  }
}
</script>